package com.JobFind.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;

import com.JobFind.DTO.RecruitmentBriefDTO;
import com.JobFind.DTO.RecruitmentDTO;
import com.JobFind.DTO.RecruitmentEasyDTO;
import com.JobFind.DTO.RecruitmentSimplyDTO;


/**
 * TbRecruitment entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="tb_recruitment" ,catalog="jobfind")
@Proxy(lazy = false)
public class TbRecruitment  implements java.io.Serializable {


	private static final long serialVersionUID = 1L;
	private Integer recruitmentId;
    private TbCompany tbCompany;
    private String recruitmentPosition;
    private String recruitmentInfo;
    private String recruitmentRemarks;
    private Integer isDeleted;
    private Integer recruitmentNum;
    private Integer recruitmentAreNum;

    // Constructors

    /** default constructor */
    public TbRecruitment() {
    }

    
    /** full constructor */
    public TbRecruitment(TbCompany tbCompany, Integer recruitmentNum,String recruitmentPosition, String recruitmentInfo,String recruitmentRemarks) {
        this.tbCompany = tbCompany;
        this.recruitmentPosition = recruitmentPosition;
        this.recruitmentInfo = recruitmentInfo;
        this.recruitmentNum = recruitmentNum;
        this.recruitmentRemarks = recruitmentRemarks;
    }

   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="RecruitmentId", unique=true, nullable=false)

    public Integer getRecruitmentId() {
        return this.recruitmentId;
    }
    
    public void setRecruitmentId(Integer recruitmentId) {
        this.recruitmentId = recruitmentId;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="CompanyId")

    public TbCompany getTbCompany() {
        return this.tbCompany;
    }
    
    public void setTbCompany(TbCompany tbCompany) {
        this.tbCompany = tbCompany;
    }
    
    @Column(name="RecruitmentPosition", length=200)

    public String getRecruitmentPosition() {
        return this.recruitmentPosition;
    }
    
    public void setRecruitmentPosition(String recruitmentPosition) {
        this.recruitmentPosition = recruitmentPosition;
    }
    
    @Column(name="RecruitmentInfo", length=65535)

    public String getRecruitmentInfo() {
        return this.recruitmentInfo;
    }
    
    public void setRecruitmentInfo(String recruitmentInfo) {
        this.recruitmentInfo = recruitmentInfo;
    }
    
    @Column(name="RecruitmentRemarks", length=65535)

    public String getRecruitmentRemarks() {
        return this.recruitmentRemarks;
    }
    
    public void setRecruitmentRemarks(String recruitmentRemarks) {
        this.recruitmentRemarks = recruitmentRemarks;
    }
    
    @Column(name="RecruitmentNum",length=11)
    public Integer getRecruitmentNum() {
		return recruitmentNum;
	}


	public void setRecruitmentNum(Integer recruitmentNum) {
		this.recruitmentNum = recruitmentNum;
	}


	public Integer getRecruitmentAreNum() {
		return recruitmentAreNum;
	}

	@Column(name="RecruitmentAreNum",length=11)
	public void setRecruitmentAreNum(Integer recruitmentAreNum) {
		this.recruitmentAreNum = recruitmentAreNum;
	}


	@Column(name="IsDeleted",length=11)
    public Integer getIsDeleted() {
		return isDeleted;
	}


	public void setIsDeleted(Integer isDeleted) {
		this.isDeleted = isDeleted;
	}


	public RecruitmentDTO toDTO(){
    	RecruitmentDTO recruitmentDTO = new RecruitmentDTO();
    	recruitmentDTO.setRecruitmentId(this.getRecruitmentId());
    	recruitmentDTO.setRecruitmentInfo(this.getRecruitmentInfo());
    	recruitmentDTO.setRecruitmentPosition(this.getRecruitmentPosition());
    	recruitmentDTO.setRecruitmentRemarks(this.getRecruitmentRemarks());
    	recruitmentDTO.setCompanyDTO(this.getTbCompany().toDTO());
    	recruitmentDTO.setRecruitmentNum(this.getRecruitmentNum());
    	recruitmentDTO.setRecruitmentAreNum(this.getRecruitmentAreNum());
    	return recruitmentDTO;
    }
    
    public RecruitmentSimplyDTO toSimplyDTO(){
    	RecruitmentSimplyDTO recruitmentSimplyDTO = new RecruitmentSimplyDTO();
    	recruitmentSimplyDTO.setCompanyName(this.getTbCompany().getCompanyName());
    	recruitmentSimplyDTO.setRecruitmentId(this.getRecruitmentId());
    	recruitmentSimplyDTO.setRecruitmentPosition(this.getRecruitmentPosition());
    	recruitmentSimplyDTO.setCompanyId(this.getTbCompany().getCompanyId());
    	recruitmentSimplyDTO.setRecruitmentNum(this.getRecruitmentNum());
    	return recruitmentSimplyDTO;
    }
    
    public RecruitmentEasyDTO toEasyDTO(){
    	RecruitmentEasyDTO recruitmentEasyDTO = new RecruitmentEasyDTO();
    	recruitmentEasyDTO.setRecruitmentId(this.getRecruitmentId());
    	recruitmentEasyDTO.setRecruitmentInfo(this.getRecruitmentInfo());
    	recruitmentEasyDTO.setRecruitmentPosition(this.getRecruitmentPosition());
    	recruitmentEasyDTO.setRecruitmentRemarks(this.getRecruitmentRemarks());
    	recruitmentEasyDTO.setRecruitmentNum(this.getRecruitmentNum());
    	return recruitmentEasyDTO;
    }
    
    public RecruitmentBriefDTO toBriefDTO(){
    	RecruitmentBriefDTO recruitmentBriefDTO = new RecruitmentBriefDTO();
    	recruitmentBriefDTO.setRecruitmentId(this.getRecruitmentId());
    	recruitmentBriefDTO.setRecruitmentPosition(this.getRecruitmentPosition());
    	recruitmentBriefDTO.setRecruitmentNum(this.getRecruitmentNum());
    	recruitmentBriefDTO.setRecruitmentAreNum(this.getRecruitmentAreNum());
    	return recruitmentBriefDTO;
    }
}